import * as mongoose from 'mongoose';

export const CorpInfoSchema = new mongoose.Schema({
  corpId: { type: String, unique: true, index: true },
  corpName: String,
  corpLogo: String,
  corpDescription: String,
  corpIndustry: String,
  corpScale: String,
  corpAddress: String,
  contactName: String,
  contactPhone: String,
  contactEmail: String,
  status: { type: Number, default: 1 }, // 1-正常 2-禁用
  permanentCode: String,
  authInfo: { type: mongoose.Schema.Types.Mixed, required: false },
  teamId: Number,
  create_time: { type: Number, default: () => Date.now() },
  update_time: { type: Number, default: () => Date.now() },
}, {
  collection: 'corp_info',
  timestamps: { currentTime: () => Date.now() }
});

// 添加索引
CorpInfoSchema.index({ corpId: 1 }, { unique: true });
CorpInfoSchema.index({ status: 1 });
CorpInfoSchema.index({ create_time: -1 });